/*
 *  BinaryLessThanOperatorAst.cpp
 *  TempWorking
 *
 *  Created by Piotr Holc on 20/11/2010.
 *  Copyright 2010 Langerra Limited. All rights reserved.
 *
#include <MAlice/Parser/location.hh>
 */

#include <MAlice/Ast/BinaryLessThanOperatorAst.h>

namespace MAlice {
	
	BinaryLessThanOperatorAst::BinaryLessThanOperatorAst(location loc, ExpressionAst* lhs,
						ExpressionAst* rhs) : BinaryOperatorAst(loc, "<", lhs, rhs) {
	MALICE_TRACE;}
	
	BinaryLessThanOperatorAst::~BinaryLessThanOperatorAst() {
		
	MALICE_TRACE;
	}
	
	llvm::Value* BinaryLessThanOperatorAst::generate()
	{
	MALICE_TRACE;
		llvm::Value* LHS = getLHS()->generate();
		llvm::Value* RHS = getRHS()->generate();
		
		checkType(LHS, RHS);
		
		Builder* builder = MAlice::Codegen::get()->getBuilder();
		
		return builder->CreateICmpSLT(LHS, RHS);
	}
	
}
